#!/usr/bin/python

# User 2%, System 4%, IOW 0%, IRQ 0%
# User 13 + Nice 0 + Sys 31 + Idle 579 + IOW 0 + IRQ 0 + SIRQ 0 = 623

class Cpuinfo:
	def __init__(self,user,nice,sys,idle,iow,irq,sirq,total):
		self.User = user
		self.Nice = nice
		self.Sys = sys
		self.Idle = idle
		self.IOW = iow
		self.IRQ = irq
		self.SIRQ = sirq
		self.Total = total
		self.temp = 0

        def dump(self):
            print 'User %-10s'%(self.User)+'Nice %-10s'%(self.Nice) \
                  +'Sys %-10s'%(self.Sys)  +'Idle %-10s'%(self.Idle) \
                  +'IOW %-10s'%(self.IOW)  +'IRQ %-10s'%(self.IRQ) \
                  +'SIRQ %-10s'%(self.SIRQ) +'Total %-10s'%(self.Total) 

        def  getCPUrate(self):
             self.temp = (float(self.User)+float(self.Nice)+float(self.Sys)+float(self.IOW)+float(self.IRQ)+float(self.SIRQ))/(float(self.Total))
             self.temp = self.temp*100
             return self.temp
